<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .v-enter,/* 显示 */
        .v-leave-to{/* 隐藏 */
            opacity: 0;/* 不透明度0表示隐藏状态 */
        }
        .v-enter-active,/* 显示 */
        .v-leave-active{/* 隐藏 */
            transition:opacity 1s;/* 检测到不透明度改变就做过渡动画 */
        }
    </style>
</head>
<body>
    <div id="app">
       <transition-group><!-- 实现列表过渡,有v-enter，v-leave-to等类 -->
            <div v-for="item of list" :key="item.id">{{item.text}}</div>
       </transition-group>
        <button @click="handleClick">add</button>
    </div>
    <script>
        var count=0;
        var vm=new Vue({
            el:'#app',
            data:{
                list:[]
            },
            methods:{
                handleClick:function(){
                    this.list.push({
                        id:count++,
                        text:'hello world'
                    })
                }
            }

        })
    </script>
</body>
</html>